<template>
	<view>
		<home v-if="PageCur=='home' && !showAds"></home>
		<web v-if="PageCur=='web' && !showAds"></web>
		<topic v-if="PageCur=='topic' && !showAds"></topic>
		<mine v-if="PageCur=='mine' && !showAds"></mine>
		<ads v-if="showAds" @click="close" adType="2" :option="adOption"></ads>
		<view v-if="!showAds" class="cu-bar tabbar bg-white foot">
			<view class="action" @click="NavChange" data-cur="home" :class="PageCur=='home'?'text-blue':'text-gray'">
				<view class="icon-24gf-home11"></view>
				<text>首页</text>
			</view>
			<view class="action" @click="NavChange" data-cur="web" :class="PageCur=='web'?'text-blue':'text-gray'">
				<view class="icon-diannao"></view>
				<text>网上营业厅</text>
			</view>
			<view class="action text-white bg-blue sm-midl" @click="toScan">
				<button class="cu-btn bg-white">扫码乘车</button>
			</view>
			<view class="action" @click="NavChange" data-cur="topic" :class="PageCur=='topic'?'text-blue':'text-gray'">
				<view class="icon-lvzhou_wuxianxinhao">
				</view>
				<text>e资讯</text>
			</view>
			<view class="action" @click="NavChange" data-cur="mine" :class="PageCur=='mine'?'text-blue':'text-gray'">
				<view class="icon-gerenzhongxin">
				</view>
				<text>个人中心</text>
			</view>
		</view>
	</view>

</template>

<script>
	import {mapState,mapGetters,mapMutations} from 'vuex'
	export default {
		data() {
			return {
				PageCur: '',
				showAds: false,
				adOption:{
					bgColor:'rgb(165, 103, 63,.8)',
					adAppid:'',
					adImg:'https://image.vshare.site/ads/2020ads.jpg',
					adDesc:'xxxxx',
					adBtn:'进入小程序',
					adType:1,
					adUrl:''
				}
				
			}
		},
		computed:{
			...mapState(['isShowAds','position','bak']),
			...mapGetters(['isLogin']),
		},
		onLoad(option) {
			console.log(option)
			this.changeAdsDisplay();
		},
		methods: {
			...mapMutations(['SET_iS_SHOW_ADS','SET_POSITION']),
			NavChange: function(e) {
				this.PageCur = e.currentTarget.dataset.cur
			},
			changeAdsDisplay: function(){
				if(this.isShowAds){
					this.showAds = true;
					this.SET_iS_SHOW_ADS(false);
				}
				this.PageCur = 'home'
			},
			close: function(){
				this.showAds = false;
			},
			toScan: function(){
				uni.navigateTo({
					url:'/pages/scancode/scancode'
				})
			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>
